<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of SimpleAdapter
 *
 * @author vampired
 */
class Golib_Auth_SimpleAdapter implements Zend_Auth_Adapter_Interface {

    protected $_username;
    protected $_password;

    public function __construct($username, $password) {
        $this->_username = $username;
        $this->_password = $password;
    }

    public function authenticate() {
        $users = array('admin');
        $password = array('roLLIad');
        if (in_array($this->_username, $users) && !in_array($this->_password, $password)) {
            return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $this->_username);
        }
        if (!in_array($this->_username, $users) && in_array($this->_password, $password)) {
            return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $this->_username);
        }
        if (!in_array($this->_username, $users) && !in_array($this->_password, $password)) {
            return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $this->_username);
        }

        return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, "LOGGED");
    }

}